package com.huatai.datacenter.controller.test;

import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author gaowengui
 * @Description 消防安全隐患记录数据接入测试
 * @Date 12:03 2025/6/14
 * @Param
 * @return
 **/
@RestController
@RequestMapping("/usertest")
public class UserTestController {

    @GetMapping("/users/run")
    public List<User> getUser() {
        List<User> users = new ArrayList<>();
        User user = new User("zhangsan", "18586421555");
        Map<String, Object> hashMap = new HashMap<>();
        users.add(user);
//        hashMap.put("data",users);
        return users;
    }

    @GetMapping("/hazard/record")
    public List<HazardRecord> getHazardRecordList() {
        List<HazardRecord> hazardRecords = new ArrayList<>();
        HazardRecord hazardRecord = new HazardRecord();
        hazardRecord.setID("safe-alarm-1");
        hazardRecord.setSubClass("线路温度异常");
        hazardRecord.setMajorClass("用电隐患告警");
        hazardRecord.setTime("2025-05-30 15:33:41");
        hazardRecord.setPatrolMission("执行消防重点部位巡察-贵阳市红城美元化工有限公司");
        hazardRecord.setHandler("齐峰");
        hazardRecord.setHandlerDep("防火处");
        hazardRecord.setBeginTime("2025-05-30 15:33:41");
        hazardRecord.setActualFinishTime("2025-05-30 15:45:33");
        hazardRecord.setState("已解决");
        hazardRecord.setUnitName("贵阳市红城美元化工有限公司");
        hazardRecord.setDistrictName("观山湖区");
        hazardRecord.setCharger("廖凯");
        hazardRecord.setContact("13797146496");
        hazardRecord.setTemperature("37");
        hazardRecord.setHumidity("54");
        hazardRecord.setWind_level("1");
        hazardRecord.setWind_dir("东南风");
        hazardRecord.setPM25("12");
        hazardRecord.setPM10("14");
        hazardRecord.setGiveCount(1);

        HazardRecord hazardRecord1 = new HazardRecord();
        hazardRecord1.setID("safe-alarm-2");
        hazardRecord1.setSubClass("烟感主机告警异常");
        hazardRecord1.setMajorClass("主机告警");
        hazardRecord1.setTime("2025-05-30 14:30:30");
        hazardRecord1.setPatrolMission("执行消防重点部位巡察-贵阳市名城西苑商贸中心");
        hazardRecord1.setHandler("齐峰");
        hazardRecord1.setHandlerDep("防火处");
        hazardRecord1.setBeginTime("2025-05-30 14:30:30");
        hazardRecord1.setActualFinishTime("2025-05-30 14:37:35");
        hazardRecord1.setState("已解决");
        hazardRecord1.setUnitName("贵阳市名城西苑商贸中心");
        hazardRecord1.setDistrictName("云岩区");
        hazardRecord1.setCharger("肖喜祥");
        hazardRecord1.setContact("18585051636");
        hazardRecord1.setTemperature("37");
        hazardRecord1.setHumidity("54");
        hazardRecord1.setWind_level("1");
        hazardRecord1.setWind_dir("南风");
        hazardRecord1.setPM25("12");
        hazardRecord1.setPM10("14");
        hazardRecord1.setGiveCount(1);

        hazardRecords.add(hazardRecord1);
        hazardRecords.add(hazardRecord);
        return hazardRecords;
    }

    @PostMapping("/hazard/getobj")
    public Map<String, Map<String, List<HazardRecord>>> getHazardRecord(@RequestBody PageDto pageDto) {
        List<HazardRecord> hazardRecords = new ArrayList<>();
//        HazardRecord hazardRecord = new HazardRecord();
//        hazardRecord.setID("safe-alarm-1");
//        hazardRecord.setSubClass("线路温度异常");
//        hazardRecord.setMajorClass("用电隐患告警");
//        hazardRecord.setTime("2025-05-30 15:33:41");
//        hazardRecord.setPatrolMission("执行消防重点部位巡察-贵阳市红城美元化工有限公司");
//        hazardRecord.setHandler("齐峰");
//        hazardRecord.setHandlerDep("防火处");
//        hazardRecord.setBeginTime("2025-05-30 15:33:41");
//        hazardRecord.setActualFinishTime("2025-05-30 15:45:33");
//        hazardRecord.setState("已解决");
//        hazardRecord.setUnitName("贵阳市红城美元化工有限公司");
//        hazardRecord.setDistrictName("观山湖区");
//        hazardRecord.setCharger("廖凯");
//        hazardRecord.setContact("13797146496");
//        hazardRecord.setTemperature("37");
//        hazardRecord.setHumidity("54");
//        hazardRecord.setWind_level("1");
//        hazardRecord.setWind_dir("东南风");
//        hazardRecord.setPM25("12");
//        hazardRecord.setPM10("14");
//        hazardRecord.setGiveCount(1);

        HazardRecord hazardRecord1 = new HazardRecord();
        hazardRecord1.setID("safe-alarm-3");
        hazardRecord1.setSubClass("烟感主机告警异常");
        hazardRecord1.setMajorClass("主机告警");
        hazardRecord1.setTime("2025-05-30 14:30:30");
        hazardRecord1.setPatrolMission("执行消防重点部位巡察-贵阳市名城西苑商贸中心");
        hazardRecord1.setHandler("齐峰");
        hazardRecord1.setHandlerDep("防火处");
        hazardRecord1.setBeginTime("2025-05-30 14:30:30");
        hazardRecord1.setActualFinishTime("2025-05-30 14:37:35");
        hazardRecord1.setState("已解决");
        hazardRecord1.setUnitName("贵阳市名城西苑商贸中心");
        hazardRecord1.setDistrictName(null);
        hazardRecord1.setCharger("肖喜祥");
        hazardRecord1.setContact("18585051636");
        hazardRecord1.setTemperature("37");
        hazardRecord1.setHumidity("54");
        hazardRecord1.setWind_level("1");
        hazardRecord1.setWind_dir(null);
        hazardRecord1.setPM25("12");
        hazardRecord1.setPM10("14");
        hazardRecord1.setGiveCount(1);

//        hazardRecords.add(hazardRecord1);
//        hazardRecords.add(hazardRecord);
        Map<String, Map<String, List<HazardRecord>>> hashMap = new HashMap<>();
        Map<String, List<HazardRecord>> hashMap1 = new HashMap<>();
        List<HazardRecord> hazardRecordsList = new ArrayList<>();
        hazardRecordsList.add(hazardRecord1);
        hashMap1.put("records", hazardRecordsList);
        hashMap.put("data", hashMap1);
        return hashMap;
    }

}
